<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var twosum = function(arr, target) {
            var result = new Array(2);
            for (var i = 0; i < arr.length - 1; i++) {
                for (var j = i + 1; j < arr.length; j++) {
                    if (arr[i] + arr[j] == target) {
                        result[0] = i;
                        result[1] = j;
                        break;
                    }
                }

            }
            return result;
        }
        twosum([1, 3, 6, 9], 15);
    </script>
</body>

</html>